release: 0.4.0#5
Conversation
|
Too many files changed for review. ( |
|
🧪 Testing To try out this version of the SDK: Expires at: Mon, 25 May 2026 05:32:12 GMT |
40a8eed to
da32a76
Compare
da32a76 to
0e1dfb9
Compare
| category().validate() | ||
| createdAt() | ||
| language() | ||
| metadata().validate() | ||
| publishedAt() | ||
| region() | ||
| score() | ||
| source() | ||
| source().validate() | ||
| sourceId() |
There was a problem hiding this comment.
Bug: When responseValidation is enabled, validate() will crash if new required fields are missing from the API response, which can happen with an older backend.
Severity: MEDIUM
Suggested Fix
The validation logic could be made more lenient for these new fields, perhaps by making them optional in the validate() method or by providing a versioning mechanism. Alternatively, clearly document this breaking change and advise users to update their backend API and SDK simultaneously, especially if they rely on response validation.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location:
x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarItem.kt#L588-L596
Potential issue: The `RadarItem`, `AccountReauthResponse`, and `AccountCreateResponse`
models have new required fields. If the SDK is used against an older API version that
does not return these fields, deserialization will succeed but the fields will be marked
as `JsonMissing`. If the user has explicitly enabled `responseValidation=true` (which is
`false` by default), the `validate()` method will be called. This method attempts to
access the required fields, triggering a `getRequired()` call that throws an
`XTwitterScraperInvalidDataException` for any missing field, causing a runtime crash.
This issue arises from a version mismatch between the client and the server.
Also affects:
x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthResponse.kt:378~382x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountCreateResponse.kt:378~382
Did we get this right? 👍 / 👎 to inform future reviews.
Automated Release PR
0.4.0 (2026-04-25)
Full Changelog: v0.3.0...v0.4.0
Features
Bug Fixes
Chores
Documentation
This pull request is managed by Stainless's GitHub App.
The semver version number is based on included commit messages. Alternatively, you can manually set the version number in the title of this pull request.
For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request.
🔗 Stainless website
📚 Read the docs
🙋 Reach out for help or questions
Note
Release 0.4.0 with new credit, health, and radar API model changes
integrations()andbot()from both blocking and async client interfaces and implementations, and dropsFOLLOWER_GAINED/FOLLOWER_LOSTfromEventTypeandSTREAM_REGISTRATION_FAILED/USAGE_LIMIT_REACHEDfromError.health(enum) as a required field onXAccount,XAccountDetail,AccountCreateResponse, andAccountReauthResponse; addscreditInfo(replacingcurrentPeriod) onAccountRetrieveResponsewithautoTopupEnabled,balance,lifetimePurchased, andlifetimeUsed.RadarItemto use strongly-typedCategoryandSourceenums and adds required fieldsid,createdAt,language,metadata, andsourceId;RadarRetrieveTrendingTopicsParamsreplacescountwith cursor-basedafter/limitand an enumcategory; response replacestotalwithhasMore/nextCursor.textoptional inTweetCreateParamsand adds an optionalmedialist (URLs); addscountandwoeidoptional params toXGetTrendsParams.ClientOptionsconstructor and removes per-callSecurityOptionsfromprepare/prepareAsync, so bearer tokens and API keys are set once at client construction time.SearchTweetandUserProfileare relocated from sub-packages tocom.x_twitter_scraper.api.models;ExtractionEstimateCostResponsereplacesprojectedPercent/usagePercentwithcreditsAvailable,creditsRequired, and optionalresolvedXUserId.currentPeriod,count,total,projectedPercent,usagePercent), removed client methods (integrations(),bot()), and new required fields (health,createdAt, etc.) will cause runtime failures for callers that do not update.Macroscope summarized cb52b50.